package com.ant.time.line.activities;

import android.databinding.DataBindingUtil;

import com.ant.time.line.R;
import com.ant.time.line.activities.adapters.TimeListAdapter;
import com.ant.time.line.beans.TimeLIneItemBean;
import com.ant.time.line.databinding.AcTimeLineBinding;
import com.ant.time.line.views.TimeLineView;

import java.util.ArrayList;
import java.util.List;


/**
 * Created with AS
 * User: Ant
 * Date: 2018/10/7
 * Time: 11:40
 * Name: TimeLineActivity
 * Description:
 *
 * @author Ant
 * @version 1.0.0
 */
public class TimeLineActivity extends BaseActivity {
    private AcTimeLineBinding binding;

    private List<TimeLIneItemBean> list = new ArrayList<>();
    private TimeListAdapter adapter;


    @Override
    public void initLayout() {
        //
        binding = DataBindingUtil.setContentView(this, R.layout.ac_time_line);
    }

    @Override
    public void initUi() {
        adapter = new TimeListAdapter();

        binding.acTimeListView.setAdapter(adapter);
    }

    @Override
    public void initData() {
        list.clear();
        int type[] = {
                TimeLineView.TYPE_DASH_TOP,
                TimeLineView.TYPE_DASH,
                TimeLineView.TYPE_TOP,
                TimeLineView.TYPE_DEFAULT,
                TimeLineView.TYPE_RANGE,
                TimeLineView.TYPE_DEFAULT,
                TimeLineView.TYPE_RANGE,
                TimeLineView.TYPE_BOTTOM,
                TimeLineView.TYPE_ALL,
                TimeLineView.TYPE_DASH_ALL,
        };

        int tt = 0;
        for (int i = 0, len = type.length; i < len; i++) {
            tt = type[i];
            TimeLIneItemBean bean = new TimeLIneItemBean();
            bean.setLineType(1);
            bean.setTitle("移动一小时48分/57公里");
            bean.setMess("四川市靖江区合江亭街道444号115号");
            bean.setType(tt);
            if (tt != TimeLineView.TYPE_DEFAULT && tt != TimeLineView.TYPE_DASH)
                bean.setTime(System.currentTimeMillis() / 1000);
            list.add(bean);
        }
        adapter.setData(list);
    }

    @Override
    public void initListener() {

    }
}
